<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:widget="http://www.netvibes.com/ns/">
	<head>
		<title>Google Search</title>
		<link rel="icon" href="http://www.google.com/favicon.ico" type="image/x-icon" />

		<meta name="author" content="Matt Johnson" />
		<meta name="description" content="A Google search Netvibes UWA widget." />
		<meta name="apiVersion" content="1.0" />
		<meta name="inline" content="false" />
		<meta name="debugMode" content="false" />

		<link rel="stylesheet" type="text/css" href="http://www.netvibes.com/themes/uwa/style.css" />
		<script type="text/javascript" src="http://www.netvibes.com/js/UWA/load.js.php?env=Standalone"></script>

		<widget:preferences>
			<preference name="numlinks" type="hidden" defaultValue="6"/>

			<preference name="title1" type="text" label="Link 1 Title" defaultValue="Images"/>
			<preference name="link1" type="text" label="Link 1 Address" defaultValue="http://images.google.com/"/>

			<preference name="title2" type="text" label="Link 2 Title" defaultValue="Maps"/>
			<preference name="link2" type="text" label="Link 2 Address" defaultValue="http://maps.google.com/"/>

			<preference name="title3" type="text" label="Link 3 Title" defaultValue="Groups"/>
			<preference name="link3" type="text" label="Link 3 Address" defaultValue="http://groups.google.com/"/>

			<preference name="title4" type="text" label="Link 4 Title" defaultValue="News"/>
			<preference name="link4" type="text" label="Link 4 Address" defaultValue="http://news.google.com/"/>

			<preference name="title5" type="text" label="Link 5 Title" defaultValue="Video"/>
			<preference name="link5" type="text" label="Link 5 Address" defaultValue="http://video.google.com/"/>

			<preference name="title6" type="text" label="Link 6 Title" defaultValue="Products"/>
			<preference name="link6" type="text" label="Link 6 Address" defaultValue="http://www.google.com/products/"/>
    		</widget:preferences>

		<style type="text/css">
			.gSearch_links {width:100%;text-align:center;}
			.gSearch_form {width:100%;text-align:center;}
			.gSearch_form input{width:100%;font-size:14px;border:1px solid gray;}
		</style>

		<script type="text/javascript">
			var gSearch = {}

			gSearch.load = function() {
				widget.body.style.padding = "0";

				myHTML = "<div class=\"gSearch_links\">";

				for (var i = 1; i <= parseInt(widget.getValue("numlinks")); i++) {
					if (widget.getValue("title" + i) != null 
						&& widget.getValue("title" + i) != ''
						&& widget.getValue("link" + i) != null
						&& widget.getValue("link" + i) != '') {
							myHTML += "<a href=\"" + widget.getValue("link" + i) + "\">" + widget.getValue("title" + i) + "</a>&nbsp;&nbsp;&nbsp;&nbsp;";
					}
				}

				myHTML += "</div>";
				myHTML += "<div class=\"gSearch_form\">";
				myHTML += "<form name=\"gSearch\" method=\"get\" action=\"http://www.google.com/search\">";
				myHTML += "<input name=\"hl\" type=\"hidden\" value=\"en\" />";
				myHTML += "<input name=\"q\" title=\"Google Search\" value=\"\" maxlength=\"2048\" class=\"gSearch_form_field\"/>";
				myHTML += "</form>";
				myHTML += "</div>";

				widget.setBody(myHTML);
				widget.body.getElementsByClassName('gSearch_form_field')[0].focus();
			}

			widget.onLoad = function() {
				gSearch.load();
			}

			widget.onRefresh = function() {
				gSearch.load();
			}

			widget.onResize = function() {
				gSearch.load();
			}
		</script>
	</head>

	<body>
		Loading...
	</body>
</html>
